package com.lframework.common.utils;

import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.Date;
import java.util.concurrent.ThreadLocalRandom;

/**
 * 对象工具类
 *
 * @author laich
 */
public class Obs extends cn.hutool.core.util.ObjectUtil {

    public static final int status_0=0;
    public static final int status_1=1;
    public static final int status_2=2;
    public static final String admin="admin";
    public static final String com_admin="com_admin";
    public static final String ORG_ID="org_id";




    private static final DateTimeFormatter TIME_FORMATTER = DateTimeFormatter.ofPattern("yyMMddHHmmssSSS");
    private static final DateTimeFormatter TIME_FORMATTER_9 = DateTimeFormatter.ofPattern("yyMMHHmm");//前面加个组织ID
    private static final DateTimeFormatter TIME_FORMATTER_4 = DateTimeFormatter.ofPattern("MMHH");//前面加个组织ID

    public static String get18SequenceNo(){
        return TIME_FORMATTER.format(LocalDateTime.ofInstant(new Date().toInstant(), ZoneId.systemDefault()))+getRanDom3();
    }
    public static String get12SequenceNo(){
        return TIME_FORMATTER_9.format(LocalDateTime.ofInstant(new Date().toInstant(), ZoneId.systemDefault()))+getRanDom3();
    }

    public static String get7SequenceNo(){
        return TIME_FORMATTER_4.format(LocalDateTime.ofInstant(new Date().toInstant(), ZoneId.systemDefault()))+getRanDom3();
    }


    public static long getRanDom3(){
        return ThreadLocalRandom.current().nextLong(100, 999);
    }

}
